feat(datatables): add tooltip support and custom button helper#111
feat(datatables): add tooltip support and custom button helper#111sebastienheyd wants to merge 3 commits intomasterfrom
Conversation
Add tooltip to button make method
- Reorder parameters: icon before tooltip for better ergonomics - Add conditional tooltip rendering to avoid empty title attributes - Implement smart icon handling to prevent empty HTML generation - Fix PSR-12 spacing (single blank line) - Add comprehensive test suite with 8 tests covering all features
|
Closing this PR in favor of a cleaner branch. Reopening as a new PR based directly on master without the original #104 commits. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f06873eed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * @param array $attributes | ||
| * @return string | ||
| */ | ||
| public static function custom(string $route, array|string $args = [], string $icon = '', string $tooltip = '', string $color = 'default', array $attributes = []): string |
There was a problem hiding this comment.
Accept mixed route args in Button::custom
Button::custom() narrows $args to array|string, which breaks the model-object usage that existing helpers already support (for example Button::edit(..., $role) in the codebase). In PHP this can coerce an Eloquent model to a JSON string via __toString(), so route() receives the wrong parameter value and generates incorrect URLs; for non-stringable objects it will throw a TypeError. Matching the mixed behavior used by show/edit/delete avoids this regression.
Useful? React with 👍 / 👎.
Summary
This PR improves upon #104 by adding tooltip support to DataTable buttons with several enhancements:
Features
custom()static helper method for simplified button creationiconbeforetooltipfor better ergonomicsImprovements over #104
iconcomes beforetooltip(more intuitive)title="")API Usage
Test Results
All 228 tests pass with 735 assertions.
Closes #104